<template>
  <div>
    <header>
      <div class="wrap flex">
        <h2>ToDoList</h2>
        <div>
          <input type="text" v-model="txt" @keyup.enter="addItem"/>
        </div>
      </div>
    </header>
  </div>
</template>

<script>
export default {
  data() {
    return {
      txt: "",
    };
  },
  
  methods: {
    addItem() {
      this.$store.commit("addToArr", this.txt);
      this.txt=""
    },

  },
};
</script>
 
<style>
header {
  height: 50px;
  background-color: #333;
  line-height: 50px;
}

header .wrap {
  justify-content: space-between;
  align-items: center;
}

header input {
  width: 300px;
  height: 30px;
  text-indent: 10px;
  padding-left: 10px;
  border-radius: 10px;
}
</style>